home *** CD-ROM | disk | FTP | other *** search
/ Aminet 40 / Aminet 40 (2000)(Schatztruhe)[!][Dec 2000].iso / Aminet / dev / misc / TCS.lha / TCS / demos / cod / SvRGBxPal.s < prev    next >
Encoding:
Text File  |  2000-09-26  |  2.6 KB  |  108 lines

  1. *******************************************************************************
  2. * SvRGBxPal.s 0.0.1
  3. *******************************************************************************
  4. * INFO    this little tool saves to file the IFF palette of the desired
  5. *    RGBx mode; optionally, you can assign the RGB value you prefer
  6. *    to the color that would look bad in Dual Cross Playfield mode
  7. *    given a certain transparent color
  8. * NOTE    for command line arguments look at the template definition at
  9. *    the bottom or type "SvRGBxPal ?" from the shell
  10. *******************************************************************************
  11.  
  12.     machine    68020
  13.  
  14.     include    INCLUDES:libraries/tcs.i
  15.     include    INCLUDES:libraries/tcs_lib.i
  16.     include    /inc/macros.i
  17.  
  18.  
  19.  
  20.     code
  21.  
  22. *******************************************************************************
  23. * open libs / command line parsing
  24.  
  25.     movea.l    4.w,a6
  26.     lea.l    DOSNm,a1
  27.     moveq.l    #37,d0
  28.     jsr    (-552,a6)    ;OpenLibrary(...)
  29.     move.l    d0,_DOSBase
  30.     beq    .exit
  31.     lea.l    GfxNm,a1
  32.     moveq.l    #37,d0
  33.     jsr    (-552,a6)    ;OpenLibrary(...)
  34.     move.l    d0,_GfxBase
  35.     beq    .ClsDOS
  36.     lea.l    TCSNm,a1
  37.     moveq.l    #1,d0
  38.     jsr    (-552,a6)    ;OpenLibrary(...)
  39.     move.l    d0,_TCSBase
  40.     beq.s    .ClsGfx
  41.  
  42.     move.l    #tmplt,d1
  43.     move.l    #CmdLnArgs,d2
  44.     moveq.l    #0,d3
  45.     movea.l    _DOSBase,a6
  46.     jsr    (-798,a6)    ;ReadArgs(tmplt,CmdLnArgs,0)
  47.     move.l    d0,_RDArgs
  48.     beq    .ClsLibs
  49.  
  50. *******************************************************************************
  51. * main
  52.  
  53.     lea.l    CmdLnArgs,a1
  54.     moveq.l    #0,d1
  55.     moveq.l    #0,d2    ;no Dual Cross Playfield
  56.     moveq.l    #0,d3    ;palette as default
  57.     movea.l    (a1),a0    ;file name pointer
  58.     move.l    ([4.w,a1]),d0    ;RGBx mode
  59.     tst.l    (8,a1)
  60.     sne.b    d1    ;set flag for Dual
  61.     extb.l    d1    ;Cross Playfield palette
  62.     beq.s    .SvPal    ;if no transparent color...
  63.     move.l    ([8.w,a1]),d2    ;get transparent color
  64.     move.l    ([12.w,a1]),d3    ;get dummy RGB value
  65.  
  66. .SvPal    CALLTCS    SvIFFRGBxPal    ;save IFF palette
  67.     beq.s    .out
  68.  
  69. *******************************************************************************
  70. * cleanup / exit
  71.  
  72. .out    move.l    _RDArgs,d1
  73.     movea.l    _DOSBase,a6
  74.     jsr    (-858,a6)    ;FreeArgs(_RDArgs)
  75.  
  76. .ClsLibs    movea.l    4.w,a6
  77.     movea.l    _TCSBase,a1
  78.     jsr    (-414,a6)    ;CloseLibrary(...)
  79. .ClsGfx    movea.l    4.w,a6
  80.     movea.l    _GfxBase,a1
  81.     jsr    (-414,a6)    ;CloseLibrary(...)
  82. .ClsDOS    movea.l    4.w,a6
  83.     movea.l    _DOSBase,a1
  84.     jsr    (-414,a6)    ;CloseLibrary(...)
  85.  
  86. .exit    moveq.l    #0,d0
  87.     rts
  88.  
  89.  
  90.  
  91. *******************************************************************************
  92. * data
  93.  
  94.     cnop    0,4
  95.  
  96. _DOSBase    dc.l    0
  97. _GfxBase    dc.l    0
  98. _TCSBase    dc.l    0
  99. _RDArgs    dc.l    0
  100.  
  101. CmdLnArgs    ds.l    4    ;command line arguments pointers
  102.  
  103. DOSNm    dc.b    "dos.library",0
  104. GfxNm    dc.b    "graphics.library",0
  105. TCSNm    TCSNAME
  106.  
  107. tmplt    dc.b    "IFF=I/A,RGBxMODE=R/A/N,TRNSPCOL=T/K/N,DUMMYRGB=D/K/N",0
  108.